home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 2000 October / Macworld CD 17.10.iso / pc / Data / Shareware / Utilities / KeyQuencer Lite 2.5.5 Installer / Developer Toolkit / Common Code / Extension.h < prev    next >
Encoding:
Text File  |  1997-09-29  |  28.2 KB  |  505 lines  |  [TEXT/CWIE]

  1. // =============================================================================
  2. // KEYQUENCER EXTENSIONS HEADER - VERSION 2.1 - FEBRUARY 1997
  3. // By Alessandro Levi Montalcini <alm@torino.alpcom.it>
  4. // ©1994-97 Binary Software, Inc. <http://www.binarysoft.com>
  5. // Don't forget to send us any cool extensions you create!
  6. // This text looks best in monaco 9 font, 4 spaces per tab, no wrapping
  7. //==============================================================================
  8. // Note that all the public interfaces that shipped with 1.2.1 are still good.
  9. // If you want to gain access to a KeyQuencer GluePtr from external software,
  10. // use the KQGestalt.c file provided with the new dev kit; it's a small piece of
  11. // code that works with both 1.2.X and 2.x and returns a valid GluePtr or NIL.
  12. //==============================================================================
  13. #pragma once
  14. #ifndef _H_extension
  15. #define _H_extension
  16.  
  17. #ifndef __APPLEEVENTS__
  18. #include <AppleEvents.h>
  19. #endif
  20.  
  21. //==============================================================================
  22. // Forward declarations:
  23.  
  24. typedef struct ParamsRec        ParamsRec, *ParamsPtr;
  25. typedef struct MachineRec        MachineRec, *MachinePtr, **MachineHandle;
  26. typedef struct GlueRec            GlueRec, *GluePtr;
  27. typedef struct EvtFilterRec        EvtFilterRec, *EvtFilterRecPtr;
  28.  
  29. // =============================================================================
  30. // FORMAT OF THE MAIN ROUTINE FOR A KEYQUENCER EXTENSION:
  31. // pascal short main(long message, ParamsPtr params, MachineHandle mac, GluePtr glue);
  32.  
  33. #ifndef CALL_KQ_EXTENSION
  34. typedef pascal short    (*ExtProcPtr)        (long message, ParamsPtr params, MachineHandle mac, GluePtr glue);
  35. #endif
  36. typedef pascal Boolean    (*EvtFilterProcPtr)    (EventRecord *event, MachineHandle mac, GluePtr glue);
  37. typedef pascal OSErr    (*FinderSelHandler)    (long count, FSSpec items[], long reference, GluePtr glue);
  38.  
  39. //==============================================================================
  40. #if PRAGMA_ALIGN_SUPPORTED
  41. #pragma options align=mac68k
  42. #endif
  43. // =============================================================================
  44. // CONSTANTS AND RESOURCE TYPES:
  45.  
  46. #define kExtensionResType    'KQex'    //  the extension res name (not file name)
  47.                                     //  is used by the macro interpreter
  48. #define kExtensionFileType    'KQex'    //  extension file type
  49. #define kExtensionCreator    'KQen'    //  extension file creator (standard icon)
  50. #define kMaxExtParams        32        //  max # of parameters passed to an extension
  51. #define kMaxScreens            3        //  max # of screens in the MachineRec record
  52.  
  53. #define kKQNoKeyCode        -1        //    key code value when no keystroke was assigned
  54. #define kKQNoModifiers        -1        //    modifiers value when no keystroke was assigned
  55.  
  56. #define kKeyFlowHPos        -19715    //  key events are ignored by KeyQuencer if 
  57. #define kKeyFlowVPos        -19949    //  event.where == { kKeyFlowHPos, kKeyFlowVPos }
  58.  
  59. #define kKQEscapeChar        0x5C    // backslash character <\> used to prefix escape sequences
  60. #define kKQDoubleQuote        0x22    // double quote character <">
  61. #define kKQSingleQuote        0x27    // single quote character <'>
  62. #define kKQBeginStrName        0x28    // open parenthesis <(>
  63. #define kKQEndStrName        0x29    // close parenthesis <)>
  64. #define kKQBeginVarName        0x5B    // open square bracket <[>
  65. #define kKQEndVarName        0x5D    // close square bracket <]>
  66.  
  67. #define kKQExtFolderType    'KQex'    // KeyQuencer Extensions folder (for use with FindKQFolder)
  68. #define kKQPrefsFolderType    'KQpr'    // KeyQuencer Prefs folder (for use with FindKQFolder)
  69.  
  70. // =============================================================================
  71. // MESSAGES (sent to the extension):
  72.  
  73. enum {
  74.     kExtMessageInit    = 'INIT',        //  setup extension, load resources;
  75.                                     //  no ParamsPtr available here
  76.     kExtMessageRun    = 'RUN '        //  run extension; the extension resource file
  77.                                     //  is already closed
  78. };
  79.  
  80. // WARNING: GLUE WAS NOT AVAILABLE AT INITIALIZE TIME IN KEYQUENCER 1.0 (now it is)
  81. // Check for nil glue before using glue routines in your kExtMessageInit handler
  82.  
  83. // =============================================================================
  84. // RESULT CODES (returned by the extension):
  85.  
  86. enum {
  87.     kExtNoError = 0,                //  no error
  88.     kExtCallMeAgain,                //  keep calling the extension over and over
  89.     kExtCallMeAgainLater,            //  call the extension again after all other
  90.                                     //  queued commands have executed
  91.     kExtUserAbortedMacro = 100,        //  code returned by LastMacroError when the
  92.                                     //  user aborts a macro with cmd-shift-return
  93.     kExtGenericError = 256,            //  positive results >= 256 stop macro execution
  94.     kExtBadEnvironment,                //  without informing the user (you may use
  95.     kExtBadParameters,                //  DisplayMessage or DisplayError to do so)
  96.     kExtTooManyParams,
  97.     kExtNotEnoughParams,
  98.     kExtUnknownKeyword,
  99.     kExtWrongApplication,
  100.     kExtNotEnoughMemory,
  101.     kExtObsoleteKeyQuencer,
  102.     kExtRequiresAppleEvents,
  103.     kExtBadKQPackage,
  104.     
  105.     kTellGenericError = -256,        //  negative results stop macro execution
  106.     kTellBadEnvironment,            //  and show a standard error message
  107.     kTellBadParameters,
  108.     kTellTooManyParams,
  109.     kTellNotEnoughParams,
  110.     kTellUnknownKeyword,
  111.     kTellWrongApplication,
  112.     kTellNotEnoughMemory,
  113.     kTellObsoleteKeyQuencer,
  114.     kTellRequiresAppleEvents,
  115.     kTellBadKQPackage
  116. };
  117.  
  118. // =============================================================================
  119. // CURRENT RECORD VERSIONS (will increase as I append more items to the records):
  120.  
  121. enum {
  122.     kCurParamsRecVers    = 1,
  123.     kCurMachineRecVers    = 1,
  124.     kGlueRecVers122        = 5,        //    minimum glueRecVers for KeyQuencer 1.2.2 and later
  125.     kGlueRecVers200        = 6,        //    minimum glueRecVers for KeyQuencer 2.0 and later
  126.     kCurGlueRecVers        = 6,        //  current glueRecVers - check it before using the glue
  127.     kCurPrivateRecVers    = 201        //    minimum privateRecVers for KeyQuencer 2.0 Lite, 2.0.1 and later
  128. };
  129.  
  130. // =============================================================================
  131. // RECORD DEFINITIONS:
  132. // The current record contents will not be modified in future versions
  133. // although more items may be appended at the bottom of each record
  134.  
  135. #ifndef ADDITIONAL_KQ_PARAMS_FIELDS
  136. #define ADDITIONAL_KQ_PARAMS_FIELDS
  137. #endif
  138.  
  139. struct ParamsRec {
  140.     ADDITIONAL_KQ_PARAMS_FIELDS                //    this is normally empty and ignored
  141.     short        paramsRecVers;                //  kCurParamsRecVers
  142.     short        paramsCount;                //  number of parameters passed
  143.     long        countCalls;                    //  this field is initially set to 0,
  144.                                             //  incremented at each kExtCallMeAgain,
  145.                                             //  always 1 after kExtCallMeAgainLater
  146.     long        firstCallTicks;                //  TickCount() of first time called
  147.                                             //  (reset when result != kExtCallMeAgain)
  148.     short        extensionKey;                //  keyCode<<8 + charCode (low word of
  149.                                             //  event.message of key down event)
  150.     short        extensionModifiers;            //  event.modifiers of the key down event
  151.                                             //  that invoked the macro
  152.     long        systemMemoryUsed;            //  you should add to this field the size of
  153.                                             //  any static handles and resources that
  154.                                             //  you allocate during kExtMessageInit
  155.     StringPtr    parameter[kMaxExtParams];    //  parameters are passed as read-only
  156.                                             //  pascal strings (including quotes if any);
  157.                                             //  all parameter processing is done by
  158.                                             //  the extension itself
  159. };
  160.  
  161. struct MachineRec {
  162.     short        machineRecVers;                //  kCurMachineRecVers
  163.     short        systemVersion;                //  system version in BCD format
  164.     short        screenCount;                //  # of screens connected to this machine
  165.     short        mainScreen;                    //  index of main screen in screenBounds array
  166.     Rect        screenBounds[kMaxScreens];    //  bounds of all available screens
  167.                                             //  (call UpdateMachineRec to validate bounds)
  168.     Boolean        hasGestalt;                    //  01
  169.     Boolean        hasWaitNextEvent;            //  02
  170.     Boolean        hasAppleEvents;                //  03
  171.     Boolean        has68020;                    //  04
  172.     Boolean        hasFPU;                        //  05
  173.     Boolean        hasColorQD;                    //  06  all these flags are automatically
  174.     Boolean        has32BitQD;                    //  07  set up by KeyQuencer so the extensions
  175.     Boolean        hasFSSpec;                    //  08  don't have to call Gestalt all the time
  176.     Boolean        hasNewStdFile;                //  09
  177.     Boolean        hasNotification;            //  10
  178.     Boolean        hasAliases;                    //  11
  179.     Boolean        hasFindFolder;                //  12
  180.     Boolean        hasPartialRes;                //  13
  181.     Boolean        hasSoundManager;            //  14
  182. };
  183.  
  184. // Here's the definition of the glue record and its routines.
  185. // To run under KQ 1.2.2 and later, make sure that glue->glueRecVers is >= kGlueRecVers122.
  186. // To run under KQ 2.0 and later, make sure that glue->glueRecVers is >= kGlueRecVers200.
  187. // To run under current and later versions, check that glue->glueRecVers is >= kCurGlueRecVers.
  188.  
  189. struct GlueRec {
  190.     short                glueRecVers;            // check this before using recent callbacks
  191.     short                privateRecVers;            // don't check this - for private use only
  192.     pascal void            (*DisplayMessage)        (ConstStr255Param message, Boolean playBeep);
  193.     pascal void            (*DisplayError)            (OSErr error);
  194.     pascal void            (*StopSequence)            (void);
  195.     pascal void            (*TypeString)            (ConstStr255Param string);
  196.     pascal void            (*TypeText)                (const unsigned char *text, short length);
  197.     pascal Boolean        (*SafePostEvent)        (const EventRecord *event);
  198.     pascal void            (*WaitTicks)            (long pause);
  199.     pascal short        (*ExecuteScript)        (Handle text);
  200.     pascal Boolean        (*ExtensionAvailable)    (ConstStr255Param name);
  201.     pascal void            (*GetCharacterInfo)        (unsigned char c, short *message, short *modifiers);
  202.     pascal Boolean        (*TrapAvailable)        (short trap);
  203.     pascal void            (*ShowStartupIcon)        (short iconID);
  204.     pascal void            (*AnonymousMessage)        (ConstStr255Param message, Boolean playBeep);
  205.     
  206. // the following routines are only available in KQ 1.1 or later;
  207. // make sure that glue->glueRecVers >= 2 or glue->glueRecVers >= kGlueRecVers122 before using them:
  208.     
  209.     pascal Boolean        (*AppleEventsAvail)        (void);
  210.     pascal Boolean        (*SendAppleEvent)        (const AppleEvent *event, OSErr *errPtr, Boolean bringToFront);
  211.     pascal Boolean        (*WindowsAvailable)        (void);
  212.     pascal Boolean        (*MacroRunning)            (void);
  213.     pascal Boolean        (*EqualStringPartial)    (ConstStr255Param strToFind, ConstStr255Param strToSearch, Boolean caseSens, Boolean partialMatch);
  214.     pascal long            (*SearchString)            (ConstStr255Param strToFind, const unsigned char *buffer, long size, Boolean caseSens);
  215.  
  216. // the following routines are only available in KQ 1.2 or later;
  217. // make sure that glue->glueRecVers >= 3 or glue->glueRecVers >= kGlueRecVers122 before using them:
  218.     
  219.     pascal WindowRef    (*RealFrontWindow)        (Boolean *isModalDialog);
  220.     pascal WindowRef    (*RealNextWindow)        (WindowRef baseWindow, Boolean *isModalDialog);
  221.     pascal Boolean        (*RealWindow)            (WindowRef window, Boolean *isModalDialog);
  222.     pascal OSErr        (*FindKQExtFolder)        (short *vRefNum, long *dirID);
  223.     pascal short        (*OpenExtResFile)        (void);
  224.     pascal void            (*UpdateMachineRec)        (void);
  225.     pascal Boolean        (*AskQuestion)            (ConstStr255Param question, ConstStr255Param okButtonTitle, ConstStr255Param cancelButtonTitle, short defaultButton, short numTextLines);
  226.     pascal Boolean        (*AskString)            (ConstStr255Param question, StringPtr answer, ConstStr255Param okButtonTitle, ConstStr255Param cancelButtonTitle, short defaultButton, short numInputLines);
  227.  
  228. // ==================== KeyQuencer 1.2.2 required below this point ====================
  229.  
  230. // the following routines are only available in KQ 1.2.2 or later;
  231. // make sure that glue->glueRecVers >= kGlueRecVers122 before using them:
  232.  
  233.     pascal short         (*CountMacros)            (void);
  234.     pascal Ptr            (*BuildSortedIndex)        (void);
  235.     pascal void            (*GetMacroInfo)            (short macroIndex, unsigned char *macroName, short *keyCode, short *modifiers);
  236.     pascal Handle        (*GetIndexedMacro)        (short macroIndex);
  237.     pascal Handle        (*GetNamedMacro)        (ConstStr31Param macroName);
  238.  
  239. // ===================== KeyQuencer 2.0 required below this point =====================
  240.  
  241. // the following routines are only available in KQ 2.0 or later;
  242. // make sure that glue->glueRecVers >= kGlueRecVers200 before using them:
  243.  
  244.     pascal Boolean        (*IsLiteralParameter)    (ConstStr255Param sourceParameter, StringPtr destString, short maxLength);
  245.     pascal Boolean        (*IsNumericParameter)    (ConstStr255Param sourceParameter, long *destNum, Boolean acceptNegative);
  246.     pascal Boolean        (*ProcessFinderSel)        (FinderSelHandler handler, long reference, OSErr *errptr);
  247.     pascal Boolean        (*KQAppleEventsBusy)    (void);
  248.     pascal OSErr        (*ExtractFileSpecs)        (ParamsPtr params, ConstStr255Param key1, ConstStr255Param key2, FSSpecPtr spec1, FSSpecPtr spec2, short defaultSpec);
  249.     pascal void            (*HoldDownModifiers)    (short modifiers);
  250.     pascal void            (*ReleaseModifiers)        (void);
  251.     pascal void            (*InstallEventFilter)    (EvtFilterRecPtr eventFilter);
  252.     pascal void            (*RemoveEventFilter)    (EvtFilterRecPtr eventFilter);
  253.     pascal DialogRef    (*GetDetachedDialog)    (Handle dlog, Handle ditl, WindowRef behind);
  254.     pascal short        (*LastMacroError)        (void);
  255.     pascal long            (*GetVariable)            (ConstStr255Param variableName, StringPtr variableValue);
  256.     pascal long            (*SetVariable)            (ConstStr255Param variableName, ConstStr255Param variableValue);
  257.     pascal long            (*ClearVariable)        (ConstStr255Param variableName);
  258.     pascal long            (*CountVariables)        (void);
  259.     pascal long            (*GetIndexedVariable)    (long variableIndex, StringPtr variableValue);
  260.     pascal OSErr        (*GetExtFileSpec)        (StringPtr extensionName, FSSpecPtr spec);
  261.     pascal Boolean        (*IsQuotedParameter)    (ConstStr255Param sourceParameter, StringPtr destString, short maxLength, unsigned char quoteChar);
  262.     pascal OSErr        (*FindKQFolder)            (short vRefNum, OSType folderType, Boolean createFolder, short *foundVRefNum, long *foundDirID);
  263.  
  264. // ==================== KeyQuencer 2.1 required below this point ====================
  265.  
  266. // the following routines and pointers are only available in KQ 2.0.1 or later;
  267. // none of them is currently available to developers, so don't try to use them.
  268. // if you really have to, make sure that glue->privateRecVers >= kCurPrivateRecVers:
  269.  
  270.     void                *MillenniumFalco;        // a spaceship in KQ? nope, just a pointer I needed
  271. };
  272.  
  273. //==============================================================================
  274.  
  275. struct EvtFilterRec {
  276.     EvtFilterRecPtr        nextFilter;        // for use by KQ only - always initialize to zero
  277.     EvtFilterProcPtr    filterProc;        // pointer to your event filter procedure
  278. };
  279.  
  280. //==============================================================================
  281. // THIS MACRO IS USED BY THE ENGINE TO CALL KEYQUENCER EXTENSIONS:
  282. // (you never need to do this yourself when writing your own extensions)
  283.  
  284. #ifndef CALL_KQ_EXTENSION
  285. #define CALL_KQ_EXTENSION(eResult, eCode, eMessage, eParams, eMac, eGlue) \
  286.     eResult = (*(eCode))((eMessage), (eParams), (eMac), (eGlue))
  287. #endif
  288.  
  289. // =============================================================================
  290. // GLUE - QUICK REFERENCE:
  291. /*
  292. DisplayMessage:        Displays a message (pascal string) via the notification mgr,
  293.                     optionally plays a system beep.
  294. DisplayError:        Displays an error (common OSErr's are shown by name in KQ 1.2).
  295. StopSequence:        Stops all macros and flushes the queue (same as cmd-shift-return).
  296. TypeString:            Types a pascal string as if the user was typing it from the keyboard.
  297. TypeText:            Same as TypeString, takes a buffer instead of a pascal string.
  298. SafePostEvent:        Checks the event queue and posts an event if it isn't already full
  299.                     (use this instead of PPostEvent); returns true if everything OK.
  300. WaitTicks:            Pauses macro execution for some time after the extension has returned.
  301. ExecuteScript:        Executes a macro (the macro text is passed in a handle);
  302.                     returns 0 if the macro was successfully queued,
  303.                     nonzero if an error was found (this is an internal error code).
  304. ExtensionAvailable:    Checks if an extension was loaded at startup.
  305. GetCharacterInfo:    Returns the keyCode, charCode and modifiers needed to type
  306.                     a given character with a keyDown event.
  307. TrapAvailable:        Checks if a trap is available (returns true if it is, false otherwise).
  308. ShowStartupIcon:    Displays a startup icon (this only works at startup time,
  309.                     when the init message is received by the extension).
  310. AnonymousMessage:    Displays a message (pascal string) without the extension name.
  311.  
  312. // the following routines are only available in KQ 1.1 or later;
  313. // make sure that glue->glueRecVers >= 2 or glue->glueRecVers >= kGlueRecVers122 before using them:
  314.  
  315. AppleEventsAvail:    Returns true if the Engine process is running, false otherwise;
  316.                     SendAppleEvent can do without the Engine process under KQ 1.2 or later.
  317. SendAppleEvent:        Sends an Apple Event; the AppleEvent record is duplicated so it can
  318.                     be allocated on the stack, while the event data handle must be in
  319.                     the system zone and is disposed of automatically by SendAppleEvent;
  320.                     never call AEDisposeDesc on the AppleEvent after passing it to
  321.                     SendAppleEvent, since it's already called by KeyQuencer for you;
  322.                     *errPtr is set to 1 right away, and receives the error code when
  323.                     the event is later sent (pass nil if you don't care, but don't wait
  324.                     for this value to change inside a loop because the Engine process will
  325.                     wait and send the event when it gets some CPU time at WaitNextEvent);
  326.                     if bringToFront is true, the receiving application is switched to
  327.                     the foreground before the event is sent; SendAppleEvent returns
  328.                     true if the event was successfully queued (not sent), false otherwise.
  329.                     ***IMPORTANT*** KeyQuencer 2.0 only accepts typeProcessSerialNumber
  330.                     or typeAppSignature as target specifiers in the Apple Event to send,
  331.                     because it has to check if the target application is background-only.
  332. WindowsAvailable:    Returns true if QuickDraw and the Window Manager have been initialized.
  333. MacroRunning:        Returns true if KeyQuencer has more extensions to call or keystrokes
  334.                     to type inside its internal queues.
  335. EqualStringPartial:    Compares two strings with optional case sensitivity and partial
  336.                     matching (strToFind is a subset of strToSearch); returns true if equal.
  337. SearchString:        Searches a string inside a buffer with optional case sensitivity;
  338.                     returns the offset of the first matching character, or a negative
  339.                     number if no match was found.
  340.  
  341. // the following routines are only available in KQ 1.2 or later;
  342. // make sure that glue->glueRecVers >= 3 or glue->glueRecVers >= kGlueRecVers122 before using them:
  343.  
  344. RealFrontWindow:    Returns the frontmost "real" window (uses RealWindow to filter
  345.                     out weird windows and floating palettes).
  346. RealNextWindow:        Returns the next "real" window behind a given base window.
  347. RealWindow:            Returns false for floating palettes, the desktop and other weird
  348.                     windows (this is an educated guess, not 100% reliable).
  349. FindKQExtFolder:    Finds the volume reference number and directory ID of the
  350.                     "KeyQuencer Extensions" folder. This is an older version of the
  351.                     FindKQFolder callback, which lets you specify the folder to find.
  352. OpenExtResFile:        Opens the extension resource file; please don't use this if you can
  353.                     do without, since PowerBook users hate to have the HD spin up
  354.                     (the opened file is NOT guaranteed to be the same file that was
  355.                     loaded at startup: it may be an updated version, or another file
  356.                     with the same name that was copied into the "KeyQuencer Extensions"
  357.                     folder); returns refnum of resfile, or -1 if the file can't be opened.
  358. UpdateMachineRec:    Updates the machine record (the screen information fields may change
  359.                     after startup with the new Multiple Scan monitors).
  360. AskQuestion:        Displays an ok/cancel dialog and returns true if the "ok" button was
  361.                     pressed; returns false when the user cancels and when an error occurs;
  362.                     pass nil or an empty string to get the default button titles.
  363. AskString:            Displays a dialog with an editable text whose contents are copied
  364.                     from and passed back to the "answer" parameter; returns the same
  365.                     values you get from AskQuestion.
  366.  
  367. // ==================== KeyQuencer 1.2.2 required below this point ====================
  368.  
  369. // the following routines are only available in KQ 1.2.2 or later;
  370. // make sure that glue->glueRecVers >= kGlueRecVers122 before using them:
  371.  
  372. CountMacros:        Returns the number of KeyQuencer macros that are currently installed.
  373. BuildSortedIndex:    IMPORTANT: THE RETURNED POINTER IS CREATED IN THE SYSTEM HEAP AND MUST BE
  374.                     DISPOSED BY THE PROGRAM THAT REQUESTED IT.
  375.                     Creates an array of macro indexes that can be used to get the macros in
  376.                     alphabetical order (based on the macro names). There are CountMacros
  377.                     short words in the array, stored in a pointer in the system heap. You
  378.                     must call DisposePtr on the returned pointer when you're done with it.
  379. GetMacroInfo:        Given a zero-based index (from 0 to CountMacros-1), this call returns the
  380.                     macro name (a pascal string with up to 31 characters), the macro's key code
  381.                     (in the high byte of the returned word) and the macro's keystroke modifiers.
  382.                     Each of the three pointers may be NIL if you don't want the related data.
  383. GetIndexedMacro:    IMPORTANT: THE RETURNED HANDLE IS CREATED IN THE SYSTEM HEAP AND MUST BE
  384.                     DISPOSED BY THE PROGRAM THAT REQUESTED IT.
  385.                     Returns a handle containing the text of the nth macro, where n is a zero-
  386.                     based index (from 0 to CountMacros-1). Returns NIL if no such macro exists.
  387.                     Use DisposeHandle on the returned handle when you're done with it.
  388. GetNamedMacro:        IMPORTANT: THE RETURNED HANDLE IS CREATED IN THE SYSTEM HEAP AND MUST BE
  389.                     DISPOSED BY THE PROGRAM THAT REQUESTED IT.
  390.                     Returns a handle containing the text of the macro whose name matches
  391.                     the "macroName" parameter; the name comparison is case-insensitive.
  392.                     Returns NIL if no macro with the given name is found. Use DisposeHandle on
  393.                     the returned handle when you're done with it.
  394.  
  395. // ===================== KeyQuencer 2.0 required below this point =====================
  396.  
  397. // the following routines are only available in KQ 2.0 or later;
  398. // make sure that glue->glueRecVers >= kGlueRecVers200 before using them:
  399.  
  400. IsLiteralParameter:    Calls IsQuotedParameter (see below) with quoteChar set to a <"> quote.
  401. IsNumericParameter:    Checks if a parameter is an integer number, accepts negative numbers
  402.                     if acceptNegative is true; if it's a number, then the numeric value
  403.                     is copied in destValue and the function returns true.
  404. ProcessFinderSel:    Gets the current Finder selection and processes each item with the
  405.                     provided handler; the handler is not called right away, since the Engine
  406.                     process has to wait for the Finder's reply to a "get selection" event;
  407.                     the disposer is called once after the handler has been called for each
  408.                     selected item, so you get a chance to dispose of anything you stored in
  409.                     the reference parameter (which can be used freely); errptr behaves
  410.                     like in SendAppleEvent; the result is true if the handler was queued
  411.                     (requires the Engine process and Finder 7.5 or later).
  412. KQAppleEventsBusy:    Returns true if the KeyQuencer Engine Process is busy (i.e. if it has
  413.                     pending Apple Events in its queues).
  414. ExtractFileSpecs:    Interprets and removes file specifications from the parameters record
  415.                     passed to the extension; key1 and key2 are the keywords of the extension
  416.                     parameters (such as "from" and "to") that specify the usage of the file
  417.                     specifications; key1 is used by default if no key is found in the macro;
  418.                     defaultSpec is the number of the FSSpec to fill if no key is found (1 or
  419.                     2), or zero if a key is always required; the vRefNum of the FSSpec
  420.                     returned is 0 if no file was specified in the macro; the following
  421.                     parameters are removed from the ParamsRec: any literal parameter,
  422.                     clipboard, sysdisk, panels, apple, system, desktop, trash, extensions,
  423.                     preferences, startup (plus key1 and key2).
  424. HoldDownModifiers:    Disables all ADB devices whose original ADB address is 2 (which is the
  425.                     original address of all Apple keyboards) and updates the low-memory
  426.                     key map so that the desired modifier keys are held down; must be
  427.                     followed by a call to ReleaseModifiers, or the keyboard stays dead.
  428. ReleaseModifiers:    Releases the modifier keys that were pressed by a previous call to
  429.                     HoldDownModifiers and re-enables the disabled ADB devices.
  430. InstallEventFilter:    Installs an event filter procedure that gets called before KeyQuencer
  431.                     does its own event filtering; event filters can be installed and removed
  432.                     at any time (not only at startup) and should return true if the event
  433.                     they received must be killed (i.e. turned into a null event); note: the
  434.                     safest time to call RemoveEventFilter is from the filter itself (see below);
  435.                     the EvtFilterRec is owned by KeyQuencer until the filter is removed, and
  436.                     it can't be moved or disposed of (don't allocate it as a local variable
  437.                     on the stack!); it contains a pointer to the event filter routine and a
  438.                     pointer to the next EvtFilterRec which should be initialized to zero and
  439.                     never touched again, since it's used by KeyQuencer to build a linked list.
  440. RemoveEventFilter:    Removes an event filter procedure that was previously installed; it is
  441.                     usually a good idea to call RemoveEventFilter from inside the event filter
  442.                     itself, since the extension's "run" routine may not be called again even
  443.                     if you returned kExtCallMeAgain (the user could have stopped the macro
  444.                     before the extension was called again).
  445. GetDetachedDialog:    Behaves pretty much like GetNewDialog, except you pass it the handles to
  446.                     a DLOG template and a DITL template that you previously loaded into memory
  447.                     (typically at startup via GetResource + DetachResource). The DITL template
  448.                     is duplicated before being used, so that your copy of the handle is not
  449.                     disposed of when the dialog is later closed (since DisposeDialog frees up
  450.                     the memory used by the items list). Use DisposeDialog (not CloseDialog)
  451.                     to close the dialog when you're done with it.
  452. LastMacroError:        Returns the last error code returned by an extension or by the macro
  453.                     interpreter. Zero means no error, values > 256 or < 0 are extension
  454.                     errors, and small positive values are private error codes returned by
  455.                     the macro interpreter (syntax errors, etc). The kExtCallMeAgain and
  456.                     kExtCallMeAgainLater codes are reported as kExtNoError (i.e. zero).
  457. GetVariable:        Gets the value of a KeyQuencer variable. Returns the variable index or
  458.                     a negative value if the variable was not found. The variable name
  459.                     should not include the "$", "&" or "%" prefixes since these are stripped
  460.                     and used at runtime by the macro processor to quote the value if needed
  461.                     (the same rule applies to all the other variable routines as well).
  462. SetVariable:        Creates a KeyQuencer variable if no variable exists with the given name,
  463.                     then sets its value to the specified string. Returns the variable index
  464.                     or a negative value if an error occurred.
  465. ClearVariable:        Removes a variable. If variableName is NIL, all variables are removed.
  466.                     Returns the number of variables that were successfully removed.
  467. CountVariables:        Returns the number of KeyQuencer variables that are currently defined.
  468. GetIndexedVariable:    Same as GetVariable except it uses a numeric index instead of the name.
  469.                     Returns a negative value if the given index is out of range.
  470. GetExtFileSpec:        Returns the FSSpec of the specified KQ extension, or the one of the
  471.                     calling extension if NIL is passed in the extensionName parameter (this
  472.                     is only allowed when calling from inside a KQ extension). Searching the
  473.                     KQ Extensions folder directly is no longer possible since it may now be
  474.                     contain different subfolders for different classes of extensions.
  475. IsQuotedParameter:    Checks if a parameter begins and ends with the specified quote character;
  476.                     if so, it copies the unquoted literal to a destination string, up to a
  477.                     maximum of maxLength characters (plus one length byte at the beginning
  478.                     of the string).
  479. FindKQFolder:        Finds the volume reference number and directory ID of the specified
  480.                     folder. Currently supports the KeyQuencer Extensions folder
  481.                     (kKQExtFolderType) and KeyQuencer Preferences folder (kKQPrefsFolderType),
  482.                     plus all the usual FindFolder constants so you don't have to link in the
  483.                     FindFolder runtime glue in your KeyQuencer extensions.
  484.                     The vRefNum and createFolder parameters should always be "kOnSystemDisk"
  485.                     and "true" for all KQ-related folders.
  486.  
  487. // ==================== KeyQuencer 2.1 required below this point ====================
  488.  
  489. // the following routines and pointers are only available in KQ 2.1 or later;
  490. // none of them is currently available to developers, so don't try to use them.
  491. // if you really have to, make sure that glue->privateRecVers >= kCurPrivateRecVers:
  492.  
  493. MillenniumFalco:    A private, undocumented KQ pointer.
  494.  
  495. */
  496. // =============================================================================
  497. #if PRAGMA_ALIGN_SUPPORTED
  498. #pragma options align=reset
  499. #endif
  500. //==============================================================================
  501.  
  502. #endif    // _H_extension
  503.  
  504. // =============================================================================
  505.